package com.it.homrwork;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @author げっしょく
 * @date 2021/8/10
 */
public class Test1_1 {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(14438);
        ThreadPoolExecutor tpe = new ThreadPoolExecutor(
                5,
                8,
                60,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(10),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy()
        );
        while (true) {
            Socket s = ss.accept();
            tpe.submit(new Test1_2(s));
        }

    }
}
